package cn.mysource.org.vo;

import cn.mysource.org.domain.Employee;
import cn.mysource.org.domain.Shop;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;


/**
 * 店铺入住 参数 vo
 */
@Data
public class ShopSettlementVo {

//        @NotNull
//    @NotEmpty   集合
    @NotBlank(message = "店铺名称不能为空！")
    private String name;
    @NotBlank(message = "店铺电话不能为空！")
    private String tel;
    @NotBlank(message = "店铺地址不能为空！")
    private String address;

    private String logo;

    @Valid
    private EmployeeVo admin;


    public Shop getShop() {
        return  Shop.builder()
                .name(this.getName())
                .tel(this.getTel())
                .address(this.getAddress())
                .logo(this.getLogo())
                .registerTime(new Date())
                .state(0)
                .build();

    }

    public Employee getEmp(){
        Employee employee = new Employee();
        BeanUtils.copyProperties(admin,employee);
        employee.setAge(18);
        employee.setState(1);
        return employee;
    }

}
